package com;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

/**
 * 接口的实列
 */
public class ConsumerTwo {
    public static void add(int i , Consumer<String> consumer){
        int count=0 ;
        List<String> list = new ArrayList<>();
        do{
            list.add(String.format("花姑娘已经%s岁了",count));
            count++;
        }while (count != i);
        list.forEach(consumer);
    }
    public static void riri(int i){
        add(i,(x)->{

            System.out.println(String.format("%s，已经睡了%s个男人了",x,-i));
        });
    }

    public static void main(String[] args) {
        riri(20);
    }
}
